let proxyObj = {};
/*webpack优化 compression-webpack-plugin 开启gzip*/
const CompressionPlugin = require("compression-webpack-plugin");
// proxyObj['/ws'] = {
//     ws: true,
//     target: "ws://localhost:8080"
// };
proxyObj['/api'] = {
    ws: false,
    target: 'http://106.12.206.156:83',
    // target: 'http://localhost:83',
    changeOrigin: true,
    pathRewrite: {
        '^/api': ''
    }
}

module.exports = {
    devServer: {
        disableHostCheck: true,
        host: '127.0.0.1',
        port: 83,
        proxy: proxyObj
    },
    configureWebpack: config => {
        if (process.env.NODE_ENV === 'production') {
            return {
                plugins: [
                    new CompressionPlugin({
                        test: /\.js$|\.html$|\.css/,
                        threshold: 1024,
                        deleteOriginalAssets: false
                    })
                ],

            }
        }
    },

}
